home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 353_02 / truck.cpp < prev    next >
C/C++ Source or Header  |  1992-01-18  |  416b  |  28 lines

  1.                                   // Chapter 7 - Program 7
  2. #include "truck.h"
  3.  
  4. void truck::init_truck(int how_many, float max_load)
  5. {
  6.    passenger_load = how_many;
  7.    payload = max_load;
  8. }
  9.  
  10.  
  11. float truck::efficiency(void)
  12. {
  13.    return payload / (payload + weight);
  14. }
  15.  
  16.  
  17. int truck::passengers(void)
  18. {
  19.    return passenger_load;
  20. }
  21.  
  22.  
  23.  
  24.  
  25. // Result of execution
  26. //
  27. // (this file cannot be executed)
  28.